{template 'header'}
  
  <body>
    <div class="x-body">
        <form class="layui-form">
            <input type="hidden" name="id" value="{$user['id']}">
            <div class="layui-form-item">
                <label for="mobile" class="layui-form-label">
                    <span class="x-red">*</span>手机号
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="mobile" name="mobile" required="" lay-verify="mobile"
                           autocomplete="off" class="layui-input" readonly value="{$user['mobile']}">
                </div>
            </div>
          <div class="layui-form-item">
            <label for="password" class="layui-form-label">
              <span class="x-red"></span>登录密码
            </label>
            <div class="layui-input-inline">
              <input type="text" id="password" name="password" required="" lay-verify="password"
                     autocomplete="off" class="layui-input" value="">
            </div>
          </div>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <button  class="layui-btn" lay-filter="add" lay-submit="">
                  修改
              </button>
          </div>
      </form>
    </div>
    <script>
        layui.use(['form','layer'], function(){
            $ = layui.jquery;
          var form = layui.form
          ,layer = layui.layer;
        
          //自定义验证规则
          form.verify({
              user_pass: [/(.+){6,12}$/, '密码必须6到12位']
              ,mobile: [/^1\d{10}$/, '输入正确的手机号码']
          });

            //监听提交
            form.on('submit(add)', function(data){
                console.log(data);
                //发异步，把数据提交给php
                var url = '{php echo $this->createWebUrl("member_list",array("op"=>"resetpassword"))}'
                $.post(url,data.field,function(ret){
                    if(ret.code) {
                        layer.msg("修改成功", {icon: 6}, function () {
                            //关闭当前frame
                            x_admin_close();
                            // 可以对父窗口进行刷新
                            x_admin_father_reload();
                        });
                    }else{
                        layer.msg(ret.msg, {icon: 0});
                    }
                },'json')
                return false;
            });


        });
    </script>
    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();</script>
  </body>

</html>